import fetch from 'common/src/utils/fetch'
const api_name = 'api/welcomeservice'
const group_name = 'tutorGuidanceRecords'



/**
 *新增指导记录查询学生
 */
function findStudent(type) {
  return fetch({
    url: `${api_name}/${group_name}/student/${type}`,
    method: 'get'
  });
}

/**
 *新增指导记录查询学生(通过教师工号)
 */
function findStudentByTeaCode(type,teacherCode) {
  return fetch({
    url: `${api_name}/${group_name}/teacher/student/${type}?teacherCode=${teacherCode}`,
    method: 'get'
  });
}


/**
 *新增指导记录
 */
function addGuideRecord(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'post',
    data: data
  });
}

/**
 *编辑指导记录
 */
function editGuideRecord(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'put',
    data: data
  });
}

/**
 *删除指导记录
 */
function deleteGuideRecord(data) {
  return fetch({
    url: `${api_name}/${group_name}`,
    method: 'delete',
    data: data
  });
}

/**
 *通过Id查找导师指导记录
 */
function findGuideRecord(id) {
  return fetch({
    url: `${api_name}/${group_name}/${id}`,
    method: 'get'
  });
}

/**
 *更改指导记录状态
 */
function updateGuideRecord(data) {
  return fetch({
    url: `${api_name}/${group_name}/status`,
    method: 'post',
    data: data
  });
}

/**
 *获取导师所属类，或者专业
 */
function getMajors(type) {
  return fetch({
    url: `${api_name}/${group_name}/major/${type}`,
    method: 'get'
  });
}

/**
 *获取导师所属类，或者专业(通过教师工号)
 */
function getMajorsByTeaCode(type,teacherCode) {
  return fetch({
    url: `${api_name}/${group_name}/teacher/major/${type}?teacherCode=${teacherCode}`,
    method: 'get'
  });
}

/**
 *获取该老师所带学生集合(根据专业，所属类)
 */
function getStudentsByMajor(type, major, grade) {
  return fetch({
    url: `${api_name}/${group_name}/studentByMajor/${type}?major=${major}&grade=${grade}`,
    method: 'get'
  });
}

/**
 *获取该老师所带学生集合(根据专业，所属类)(通过教师工号)
 */
function getStudentsByMajorByTeaCode(type, major, grade,teacherCode) {
  return fetch({
    url: `${api_name}/${group_name}/teacher/studentByMajor/${type}?major=${major}&grade=${grade}&teacherCode=${teacherCode}`,
    method: 'get'
  });
}
function getDownloadZipUrl() {
  return `${api_name}/${group_name}/downloadZip`
}


export default {
  addGuideRecord: addGuideRecord,
  editGuideRecord: editGuideRecord,
  deleteGuideRecord: deleteGuideRecord,
  findStudent: findStudent,
  findGuideRecord: findGuideRecord,
  updateGuideRecord: updateGuideRecord,
  getMajors: getMajors,
  getStudentsByMajor: getStudentsByMajor,
  findStudentByTeaCode:findStudentByTeaCode,
  getMajorsByTeaCode:getMajorsByTeaCode,
  getStudentsByMajorByTeaCode:getStudentsByMajorByTeaCode,
  getDownloadZipUrl:getDownloadZipUrl
}
